<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="org.tigr.htc.persist.*" %>
<%@ page import="org.tigr.htc.common.*" %>
<%@ page import="org.tigr.htc.cmd.*" %>


<%!
    static String[] colors = new String[] { "#ececec", "#dc9000" };
%>
<html>
<head>
</head>

<body>
Display Request Information
<form method="get" action="request_display.jsp">
    Display request with id <input type="text" name="RequestID" value=""/>&nbsp;<input type="submit" value="find" /><br>

</form>

<%
IPersist pl = PersistFactory.getIPersist();
long id;
Command cmd;
String sid = request.getParameter("RequestID");
if(sid != null) { // display default page
    id = Long.parseLong(sid);
    cmd = (Command) pl.find(id, Command.class);
%>
<table>
<tr>
<td>
  <table border=1>
    <tr bgcolor="#00a8ec"><td colspan=2>Request Information</td></tr>
    <tr><td>ID</td><td><%=cmd.getID() %></td></tr>
    <tr><td>Command Name</td><td><%=cmd.getName() %></td></tr>
    <tr><td>Username</td><td><%=cmd.getUserName() %></td></tr>
    <tr><td>Group</td><td><%=cmd.getGroup() %></td></tr>
    <tr><td>Submitted  from</td><td><%=cmd.getSubmitURL() %></td></tr>
  </table>
</td>
<td>
  <table border=1>
     <tr bgcolor="#00a8ec"><td colspan=2>Command Information</td></tr>
     <tr><td>Executable</td><td><%=cmd.getCommand() %></td></tr>
     <tr><td>Initial Directoy (CWD)</td><td><%=cmd.getInitialDir() %></td></tr>
     <tr><td>Standard Output</td><td><%=cmd.getOutput() %></td></tr>
     <tr><td>Standard Error</td><td><%=cmd.getError() %></td></tr>
<% 
if(cmd.getParamsCount() > 0) {
    Iterator params =  cmd.getParams().iterator();
    for( ; params.hasNext(); ) {
	Param param = (Param) params.next();
%>
     <tr><td colspan=2>
	  <table>
	  <tr>
	    <td><%= param.getType() %></td>
	    <td><%= param.getKey() %></td>
	    <td><%= param.getValue() %></td>
	  </tr>
	  </table>
     </td></tr>
<% 
	  }
}
%>

   </table>
</td>
<td>
  <table border=1>
     <tr bgcolor="#00a8ec"><td colspan=2>Command Status Information</td></tr>
     <tr><td>State</td><td><%=cmd.getState() %></td></tr>
     <tr><td>Submit Time</td><td><%=cmd.getStartTime() %></td></tr>
     <tr><td>Start Time</td><td><%=cmd.getStartTime() %></td></tr>
     <tr><td>End Time</td><td><%=cmd.getEndTime() %></td></tr>
     <tr><td>Notify Script</td><td><%=cmd.getNotifyScript() %></td></tr>
  </table>
</td>
</tr>
</table>

<% } %>
<hr>
tigr copyright notice here

</body>
</html>
